package com.qiqv.service.impl;

import com.qiqv.dto.OrderDto;
import com.qiqv.service.OrderService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @author hjr
 * @version 1.0
 * @date 2023/12/9 14:21
 */
@Service
public class OrderServiceImpl implements OrderService {


    @Override
    public List<OrderDto> getAllOrders() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        List<OrderDto> list = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            list.add(generatorOrder());
        }
        return list;
    }

    private OrderDto generatorOrder() {
        OrderDto dto = new OrderDto();
        dto.setOrderId(UUID.randomUUID().toString());
        dto.setPayTime(LocalDateTime.now());
        dto.setComment("测试备注");
        return dto;
    }
}
